home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 1 / Amiga Tools.iso / egs-tools / egs_demo-version / egs_devels / c-include / egsintuigfx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-06  |  25.5 KB  |  697 lines

  1. #ifndef EGS_EGSINTUIGFX_H
  2. #define EGS_EGSINTUIGFX_H
  3.  
  4. /***************************************************************************\
  5. *  $
  6. *  $ FILE     : egsintuigfx.h
  7. *  $ VERSION  : 1
  8. *  $ REVISION : 2
  9. *  $ DATE     : 02-Feb-93 22:55
  10. *  $
  11. *  $ Author   : mvk
  12. *  $
  13. *
  14. *****************************************************************************
  15. *                                                                           *
  16. * (c) Copyright 1990/93 VIONA Development                                   *
  17. *     All Rights Reserved                                                   *
  18. *                                                                           *
  19. \***************************************************************************/
  20.  
  21. #ifndef         EGS_EGSGFX_H
  22. #include        <egs/egsgfx.h>
  23. #endif
  24.  
  25.  
  26.  
  27. /*
  28.  * To make rendering of graphics in windows, menus and gadgets as flexible,
  29.  * efficient and powerful as possible, the ESGIntui library has an inter-
  30.  * preter that executes programs of a simple stack graphics language.
  31.  *
  32.  * Programs in this language are used for all EGSIntui graphics such as
  33.  * gadgets, menus and "requesters".  As the language knows subroutines with
  34.  * parameters, this technique is much more flexible than the known one
  35.  * with separate border, text and image lists.
  36.  *
  37.  *  Examples:
  38.  *
  39.  *   - If you need similar shadowed text for requesters or menus you need to
  40.  *     define only one such procedure.  Then you call it each time you need
  41.  *     that text with the string as parameter.
  42.  *
  43.  *   - For gadgets with three-dimensional borders it is sufficient to program
  44.  *     that border only once since the EGSIntui library passes over the
  45.  *     position and size for the .select and .release graphics of requesters
  46.  *     and menus.
  47.  *
  48.  *   - If you need the same element for some graphics, e.g. colour selection
  49.  *     requesters, these can be rendered by a program loop.
  50.  *
  51.  *   - Frequently used graphics elements can be collected in a module and be
  52.  *     reused again and again.
  53.  *
  54.  *   - As you have access to the standard colours of a window (screen) from
  55.  *     inside an IntuiGfx program, the same requesters can be used for
  56.  *     different bit depths and colour palettes without change.
  57.  *
  58.  *   - As gadgets or menue elements may vary in size, according to the used
  59.  *     font and/or language, functions for rescalable images are supported.
  60.  *
  61.  */
  62.  
  63.  
  64.  
  65. /*
  66.  * WinColors
  67.  *
  68.  * To give requesters etc. an optimal colouring even for different bit depths,
  69.  * for each screen (or window) a structure is defined that contains the usual
  70.  * colours with their values.  These colours can be accessed from IntuiGfx
  71.  * programs.  Moreover, the colours are used in (string) gadgets.
  72.  *
  73.  * .Light     : A light coulour for 3D structures.
  74.  * .Normal    : The colour of a non-selected object.
  75.  * .Dark      : A dark colour for shadow effects.
  76.  * .Select    : The colour of a selected object.
  77.  * .Back      : A window's background colour.
  78.  * .TxtFront  : Colour for text.
  79.  * .TxtBack   : Background colour for text.
  80.  */
  81.  
  82. typedef struct IG_WinColors *IG_WinColorsPtr;
  83.  
  84. struct IG_WinColors {
  85.     LONG Light, Normal, Dark, Select, Back, TxtFront, TxtBack;
  86. };
  87.  
  88.  
  89.  
  90. /*
  91.  * An IntuiGfx program consists of an array of long words containing con-
  92.  * stants, addresses or commands.  Commands and constants differ from addresses
  93.  * in that their highest bit is set (even Commodore uses this high-bit so
  94.  * that no compatibility problems should occur).  The end of a program is
  95.  * specified by the special command "RTS" or "RTF+...".
  96.  *
  97.  * The language is stack oriented, i.e. commands and procedures always refer
  98.  * to parameters pushed onto the stack.  Besides the stack pointer (SP) there
  99.  * exists a frame pointer (FP) that addresses parameters and local variables.
  100.  * By the command "FRAME" this variable range can be increased.
  101.  *
  102.  * For many commands needing constant data that data is simply added to the
  103.  * command token.
  104.  *
  105.  * The stack works with predecrement (PUSH) and postincrement (POP) so that
  106.  * older elements are addressed with positive displacements.
  107.  *
  108.  * All commands returning a value pass it on the stack, likewise all commands
  109.  * and procedures expect their parameters on the stack and deallocate them
  110.  * automatically.
  111.  *
  112.  * All graphics coordinates in an IntuiGfx program regard the graphics cursor
  113.  * position at the beginning of the procedure as origin.  The interpreter
  114.  * can be invoked with parameters that are passed on the stack as usual.
  115.  * EGSIntui does this too, e.g. for .active and .release calls for gadgets
  116.  * and menus.
  117.  *
  118.  * The normal parameters for intui structures as gadgets or menues is
  119.  * (width, height).
  120.  *
  121.  *###########################################################################
  122.  *
  123.  * Command overview:
  124.  *
  125.  *
  126.  * (1). Stack and frame specific commands
  127.  *
  128.  *
  129.  *  POP   : Removes the topmost stack element.
  130.  *          INC(SP)
  131.  *
  132.  *  POPN  : Removes the number of stack element as specified by SP[0].
  133.  *          INC(SP,SP[0]+1)
  134.  *
  135.  *  DUP   : Duplicates the topmost stack element.
  136.  *          SP-^:=SP[0]
  137.  *
  138.  *  DUPN  : Duplicates as many elements as specified by SP[0].
  139.  *          x:=SP+^;SP-^:=SP[0..x]
  140.  *
  141.  *  DUPI  : Duplicates as many elements as specified by DUPI.
  142.  *          x:='DUPI';SP-^:=SP[0..x]
  143.  *
  144.  *  SWAP  : Swaps the two topmost stack elements.
  145.  *          PS[1] <-> SP[0];
  146.  *
  147.  *  ROT3  : Rotates the topmost three elements.
  148.  *          SP[2] -> SP[0] -> SP[1] -> SP[2]
  149.  *
  150.  *  ROTN  : Rotates as many elements as specified by SP[0].
  151.  *          x:=SP+^;SP[x] -> SP[0] -> SP[1] -...-> SP[x]
  152.  *
  153.  *  BYTE  : Reads a byte from the memory address SP^.
  154.  *          SP[0]:=BytePtr(SP[0])^
  155.  *
  156.  *  VAL   : Reads a word from the memory address SP^.
  157.  *          SP[0]:=IntPtr(SP[0])^
  158.  *
  159.  *  ADR   : Reads a long word from the memory address SP^.
  160.  *          SP[0]:=LongPtr(SP[0])^
  161.  *
  162.  * There are also POKE commands for byte, word and long (see below) !
  163.  *
  164.  *  GET1  : Gets the second stack element.
  165.  *          SP-^:=SP[1]
  166.  *
  167.  *  GET2  : Gets the third stack element.
  168.  *          SP-^:=SP[2]
  169.  *
  170.  *  GETN  : Gets the SP[0]'th stack element.
  171.  *          SP[0]:=SP[SP[0]+1]
  172.  *
  173.  *  GETSI : Gets the stack element specified by GETSI.
  174.  *          SP-^:=SP['GETSI']
  175.  *
  176.  *  GETF  : Gets the SP[0]'th stack element.
  177.  *          SP[0]:=FP[SP[0]]
  178.  *
  179.  *  GETFI : Get the frame element specified by GETFI.
  180.  *          SP-^:=FP['GETFI']
  181.  *
  182.  *  PUTF  : Writes SP[1] to the frame element specified by SP[0].
  183.  *          FP[SP[0]]:=SP[1];INC(SP,2)
  184.  *
  185.  *  PUTFI : Writes SP[0] to the frame element specified by PUTFI.
  186.  *          FP['PUTFI']:=SP[0];INC(SP)
  187.  *
  188.  *  Const : Pushes a constant onto the stack.
  189.  *          SP-^:='Const'
  190.  *
  191.  *  Const24:Pushes the constant in Const24 shifted left by eight bits onto
  192.  *          the stack (for 24 bit colours).
  193.  *          SP-^:='Const24' SHL 8
  194.  *
  195.  *  STKADR: Pushes the actual value of the stackpointer onto the stack.
  196.  *          SP-^:=SP;
  197.  *
  198.  * (2). Arithmetic and logic commands
  199.  *
  200.  *
  201.  *  ADD   : Adds the two topmost stack elements.
  202.  *          SP[1]:=SP[1]+SP[0];INC(SP)
  203.  *
  204.  *  ADDI  : Adds the ADDI constant to SP[0].
  205.  *          SP[0]:=SP[0]+'ADDI'
  206.  *
  207.  *  SUB   : Subtracts the first stack element from the second.
  208.  *          SP[1]:=SP[1]-SP[0];INC(SP)
  209.  *
  210.  *  NEG   : Negates the topmost stack element.
  211.  *          SP[0]:=-SP[0]
  212.  *
  213.  *  MUL   : Multiplies the two topmost stack elements.
  214.  *          SP[1]:=SP[1]*SP[0];INC(SP)
  215.  *
  216.  *  IDIV  : Divides the second stack element by the first.
  217.  *          SP[1]:=SP[1]/SP[0];INC(SP)
  218.  *
  219.  *  IMOD  : Divides the second stack element by the first and yields the
  220.  *          modulus of the operation.
  221.  *          SP[1]:=SP[1] mod SP[0];INC(SP)
  222.  *
  223.  *  SEQ   : Tests if SP[1] is equal to SP[0]; result -1 if true, else 0.
  224.  *          IF SP[1]=SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  225.  *
  226.  *  SNE   : Tests if SP[1] not equal to SP[0]; result -1 if true, else 0.
  227.  *          IF SP[1]#SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  228.  *
  229.  *  SGT   : Tests if SP[1] greater than SP[0]; result -1 if true, else 0.
  230.  *          IF SP[1]>SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  231.  *
  232.  *  SLT   : Tests if SP[1] less than SP[0].
  233.  *          IF SP[1]<SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  234.  *
  235.  *  SGE   : Tests if SP[1] greater or equal to SP[0].
  236.  *          IF SP[1]>=SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  237.  *
  238.  *  SLE   : Tests if SP[1] less or equal to SP[0].
  239.  *          IF SP[1]<=SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  240.  *
  241.  *  SNOT  : Result 0 if SP[0] not zero, else -1.
  242.  *          IF SP[0]=0 THEN SP[0]:=-1 ELSE SP[0]:=0 END;
  243.  *
  244.  *  SAND  : Result -1 if SP[0] and SP[1] are both not zero, else 0.
  245.  *          IF SP[0]#0 AND SP[1]#0 THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  246.  *
  247.  *  SOR   : Result -1 if SP[0] or SP[1] is not zero, else 0.
  248.  *          IF SP[0]#0 OR SP[1]#0 THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  249.  *
  250.  *
  251.  * (3). Program control commands
  252.  *
  253.  *
  254.  *  JMP   : Jumps to the address SP[0].
  255.  *          PC:=SP[0];INC(SP)
  256.  *
  257.  *  RTS   : Return from a subroutine without frame deallocation.
  258.  *          POP(PC)
  259.  *
  260.  *  RTF   : Return form a subroutine with frame deallocation.
  261.  *          SP:=FP+'RTF';POP(PC)
  262.  *
  263.  *  JSR   : Calls a subroutine at the specified location.
  264.  *          PUSH(PC);PC:=SP[0];INC(SP)
  265.  *
  266.  *  While S1 Do S2 End : Executes program segments S1 and S2 as long as after
  267.  *                       S1 a value not equal to zero 0 is on the stack.
  268.  *                       Then that value is deallocated.
  269.  *
  270.  *  If S1 Else S2 End  : Executes S1 if for "If" a value not equal to zero
  271.  *                       is on the stack, else S2 is executed.  Then that
  272.  *                       value is deallocated.
  273.  *
  274.  *  Repeat S1 Until    : Executes S1 until then a value not equal to zero is
  275.  *                       on the stack.  Then that value is deallocated.
  276.  *
  277.  *
  278.  * (4). Graphics commands
  279.  *
  280.  *
  281.  *  Color : Sets the current colour to the value in SP[0].
  282.  *          SetAPen(r,SP[0]);INC(SP)
  283.  *
  284.  *  Back  : Sets the background colour to the value in SP[0].
  285.  *          SetBPen(r,SP[0]);INC(SP)
  286.  *
  287.  *  ModeA : Sets drawing mode "drawAPen".
  288.  *          SetDrMd(r,drawAPen)
  289.  *
  290.  *  ModeAB: Sets drawing mode "drawABPen".
  291.  *          SetDrMd(r,drawABPen)
  292.  *
  293.  *  ModeInvers: Sets drawing mode "invert".
  294.  *          SetDrMd(r,invert)
  295.  *
  296.  *  Image : Copies the contents of a BitMap specified by SP[0] to the
  297.  *          current cursor position.
  298.  *          map:=BitMapPtr(SP[0]);INC(SP);
  299.  *          CopyBitMapRastPort(map,r,0,0,map.^width,map.^height,r^.cx,r^.cy);
  300.  *
  301.  *  Packed: Unpacks an image from bit plane form and copies it to the current
  302.  *          cursor position.
  303.  *          image:=ImagePtr(SP[0]);col:=ColorTablePtr(SP[1]);INC(SP,2);
  304.  *          IF UnpackImage(map,image^,r^.depth,col^) THEN
  305.  *            CopyBitMapRastPort(map'PTR,r,0,0,map.width,map.height...
  306.  *            DisposeBitMap(map)
  307.  *          END
  308.  *
  309.  *  Move  : Moves the graphics cursor by the distance in (SP[1],SP[0]).
  310.  *          INC(r^.cx,SP[1]);INC(r^.cy,SP[0]);INC(SP,2)
  311.  *
  312.  *  Locate: Sets the cursor to the position (SP[1],SP[0]).
  313.  *          Move(r,SP[1],SP[0]);INC(SP,2)
  314.  *
  315.  *  Locate00: Resets the cursor to the origion.
  316.  *            Move(r,0,0)
  317.  *
  318.  *  Draw  : Draws a line by (SP[1],SP[0]) relative from the cursor position.
  319.  *          Draw(r,r^.cx+SP[1],r^.cy+SP[0]);INC(SP,2);
  320.  *
  321.  *  DrawAbs:Draws a line from the cursor to the point (SP[1],SP[0]).
  322.  *          Draw(r,SP[1],SP[0]);INC(SP,2)
  323.  *
  324.  *  Box   : Draws a filled rectangle with width SP[1] and height SP[0].
  325.  *          RectangleFill(r,r^.cx,r^.cy,SP[1],SP[0]);INC(SP,2)
  326.  *
  327.  *  Box2d : Draws a rectangular border width width SP[1] and height SP[0].
  328.  *            Draw(rast,r.cx+SP[1]-1,r.cy);
  329.  *            Draw(rast,r.cx,r.cy+SP[0]-1);
  330.  *            Draw(rast,r.cx-SP[1]+1,r.cy);
  331.  *            Draw(rast,r.cx,r.cy-SP[0]+1);
  332.  *            DEC(SP,2);
  333.  *
  334.  *  Box3d : Draws a pseudo three dimensional rectangular border.
  335.  *          width SP[1], height SP[0], top left color SP[2] and bottom
  336.  *          right color SP[3];
  337.  *
  338.  *  Rect3d: Draws a pseudo three dimensional filled rectangular border.
  339.  *          width SP[1], height SP[0], top left color SP[2] and bottom
  340.  *          right color SP[3], interiour color SP[4];
  341.  *
  342.  *  Write : Writes text to the current cursor position.  SP[0] is the string
  343.  *          pointer.  The first byte contains the string length, followed
  344.  *          by the string characters.  ATTENTION:  This is a Cluster string !
  345.  *          Text(r,SP[0]^.data'PTR,SP[0]^.len);INC(SP)
  346.  *
  347.  *  Text  : Writes text to the current cursor position aus.  SP[0] is the
  348.  *          string pointer to a null-terminated string.  This procedure
  349.  *          should be used by C programmers.
  350.  *          Text(r,SP[0],Length(SP[0]^));
  351.  *
  352.  *  Font  : Sets an EFont given by SP[0].  SP[0] is the pointer to an opened
  353.  *          EFont.
  354.  *          r^.font:=EFontPtr(SP[0]);INC(SP)
  355.  *
  356.  *
  357.  *
  358.  * (5). Graphics functions
  359.  *
  360.  *
  361.  *  GetPosX: Gets the current cursor X coordinate.
  362.  *           INC(SP);SP[0]:=r^.cx
  363.  *
  364.  *  GetPosY: Gets the current cursor Y coordinate.
  365.  *           INC(SP);SP[0]:=r^.cy;
  366.  *
  367.  *  GetColor: Gets the current drawing colour.
  368.  *            INC(SP);SP[0]:=r^.aPen
  369.  *
  370.  *  GetBack : Gets the current background colour.
  371.  *            INC(SP);SP[0]:=r^.bPen
  372.  *
  373.  *  CLight    : Gets the light window colour.
  374.  *  CNormal   : Gets the normale window border colour.
  375.  *  CDark     : Gets the dark window colour.
  376.  *  CSelect   : Gets the "selected" window colour.
  377.  *  CBack     : Gets the window background colour.
  378.  *  CTxtFront : Gets the recommended window text front colour.
  379.  *  CTxtBack  : Gets the recommenden window text background colour.
  380.  *
  381.  *  CTAGs     : Gets the value of a window color. The value of the command
  382.  *              is the same as that of the tag.
  383.  *
  384.  *
  385.  * (6). Scaled functions
  386.  *
  387.  *  All scaled command work in a fixed coordinate space [0..4095]x[0..4095].
  388.  *  This coordinate space is translated to a selected rectangular area that
  389.  *  is specified by 'SetScale'.
  390.  *
  391.  *  SetScale  : Sets the rectangular area in which to work, width in SP[1]
  392.  *              and height in SP[0].
  393.  *  SetRatio  : Forces a ratio of SP[1]/SP[0], and changes the drawing
  394.  *              coordinates to fit inside the original area.
  395.  *
  396.  *  SMove     : Moves the graphiccursor by SP[1]/SP[0].
  397.  *  SLocate   : Moves the graphiccursor to SP[1]/SP[0].
  398.  *  SDraw     : Draws a line by SP[1]/SP[0].
  399.  *  SDrawAbs  : Draws a line to SP[1]/SP[0].
  400.  *  SCurve    : Draws a curve with SP[5]/SP[4] and SP[3]/SP[2] by SP[1]/SP[0]
  401.  *  SCurveAbs : Draws a curve with SP[5]/SP[4] and SP[3]/SP[2] to SP[1]/SP[0]
  402.  *  SEllipse  : Draws an ellipse with SP[1] as half the width, and
  403.  *              SP[0] as half the height. Drawn around the cursor.
  404.  *
  405.  *  SAMove    : Moves the graphiccursor by SP[1]/SP[0].
  406.  *  SALocate  : Moves the graphiccursor to SP[1]/SP[0].
  407.  *  SADraw    : Adds an edge to a polygon by SP[1]/SP[0].
  408.  *  SADrawAbs : Adds an edge to a polygon to SP[1]/SP[0].
  409.  *  SACurve   : Adds a curve to a filled object with SP[5]/SP[4] and
  410.  *              SP[3]/SP[2] by SP[1]/SP[0]
  411.  *  SACurveAbs: Adds a curve to a filled object with SP[5]/SP[4] and
  412.  *              SP[3]/SP[2] to SP[1]/SP[0]
  413.  *  SAEnd     : Closes the current area-polygon and fills it.
  414.  *  SAEllipse : Draws a filled ellipse with SP[1] as half the width, and
  415.  *              SP[0] as half the height. Drawn around the cursor.
  416.  
  417.  */
  418.  
  419.  
  420. #define IG_JMP       0x80000001
  421. #define IG_RTS       0x80000002
  422. #define IG_JSR       0x80000003
  423. #define IG_CALL      0x80000004
  424. #define IG_POP       0x80000011
  425. #define IG_DUP       0x80000012
  426. #define IG_SWAP      0x80000013
  427. #define IG_ROT3      0x80000014
  428. #define IG_ROTN      0x80000015
  429. #define IG_BYTE      0x80000111
  430. #define IG_VAL       0x80000016
  431. #define IG_ADR       0x80000017
  432. #define IG_GET1      0x80000018
  433. #define IG_GET2      0x80000019
  434. #define IG_GETN      0x8000001A
  435. #define IG_POPN      0x8000001B
  436. #define IG_DUPN      0x8000001C
  437. #define IG_GETF      0x8000001D
  438. #define IG_PUTF      0x8000001E
  439. #define IG_STKADR    0x8000001F
  440. #define IG_POKEB     0x80000113
  441. #define IG_POKEW     0x80000114
  442. #define IG_POKE      0x80000115
  443. #define IG_ADD       0x80000021
  444. #define IG_NEG       0x80000022
  445. #define IG_SUB       0x80000023
  446. #define IG_MUL       0x80000024
  447. #define IG_IDIV      0x8000002E
  448. #define IG_IMOD      0x8000002F
  449. #define IG_SEQ       0x80000025
  450. #define IG_SNE       0x80000026
  451. #define IG_SGT       0x80000027
  452. #define IG_SLT       0x80000028
  453. #define IG_SGE       0x80000029
  454. #define IG_SLE       0x8000002A
  455. #define IG_SNOT      0x8000002B
  456. #define IG_SAND      0x8000002C
  457. #define IG_SOR       0x8000002D
  458. #define IG_GetPosX   0x80000031
  459. #define IG_GetPosY   0x80000032
  460. #define IG_GetColor  0x80000033
  461. #define IG_GetBack   0x80000034
  462. #define IG_Color     0x80000041
  463. #define IG_Back      0x80000042
  464. #define IG_ModeA     0x80000043
  465. #define IG_ModeAB    0x80000044
  466. #define IG_ModeInvers 0x80000112
  467. #define IG_Image     0x80000045
  468. #define IG_Move      0x80000046
  469. #define IG_Draw      0x80000047
  470. #define IG_Write     0x80000048
  471. #define IG_Text      0x8000004F
  472. #define IG_Box       0x80000049
  473. #define IG_Locate    0x8000004A
  474. #define IG_Locate00  0x8000004B
  475. #define IG_Packed    0x8000004C
  476. #define IG_Font      0x8000004D
  477. #define IG_DrawAbs   0x8000004E
  478. #define IG_Box3d     0x80000401
  479. #define IG_Rect3d    0x80000402
  480. #define IG_Box2d     0x80000403
  481. #define IG_CLight    0x80000050
  482. #define IG_CNormal   0x80000051
  483. #define IG_CDark     0x80000052
  484. #define IG_CSelect   0x80000053
  485. #define IG_CBack     0x80000054
  486. #define IG_CTxtFront 0x80000055
  487. #define IG_CTxtBack  0x80000056
  488. #define IG_While     0x80000101
  489. #define IG_Do        0x80000102
  490. #define IG_If        0x80000103
  491. #define IG_Else      0x80000104
  492. #define IG_End       0x80000105
  493. #define IG_Repeat    0x80000106
  494. #define IG_Until     0x80000107
  495. #define IG_Debug     0x80000200
  496. #define IG_Const     0x81008000
  497. #define IG_Const24   0x89000000
  498. #define IG_GETFI     0x82000000
  499. #define IG_PUTFI     0x83000000
  500. #define IG_GETSI     0x84000000
  501. #define IG_FRAME     0x85000000
  502. #define IG_RTF       0x86000000
  503. #define IG_ADDI      0x87008000
  504. #define IG_DUPI      0x88000000
  505. #define IG_POPI      0x8A000000
  506. #define IG_SetScale  0x80000300
  507. #define IG_SetRadio  0x80000301
  508. #define IG_SMove     0x80000311
  509. #define IG_SLocate   0x80000312
  510. #define IG_SDraw     0x80000313
  511. #define IG_SDrawAbs  0x80000314
  512. #define IG_SCurve    0x80000315
  513. #define IG_SCurveAbs 0x80000316
  514. #define IG_SEllipse  0x80000317
  515. #define IG_SAMove    0x80000321
  516. #define IG_SALocate  0x80000322
  517. #define IG_SADraw    0x80000323
  518. #define IG_SADrawAbs 0x80000324
  519. #define IG_SACurve   0x80000325
  520. #define IG_SACurveAbs 0x80000326
  521. #define IG_SAEllipse 0x80000327
  522. #define IG_SAEnd     0x8000033F
  523.  
  524. typedef ULONG IG_IntuiGfx;
  525. typedef IG_IntuiGfx *IG_IntuiGfxPtr;
  526.  
  527. /* Examples of using IntuiGfx stack programs:
  528.  *
  529.  *
  530.  *  Examples:
  531.  *
  532.  *    - Box3d       : Draw a rectangle in two colours.  To get a 3D effect
  533.  *                    the top and left line are coloured different from the
  534.  *                    bottom and right line. (Same as IG_Box3d).
  535.  *                    Thus parameters are two colours, "bottomRight" and
  536.  *                    "topLeft", and the "width" and "height".
  537.  *
  538.  *                    Parameters:
  539.  *
  540.  *                       - bottomRight (FP+3) : Colour for left and top
  541.  *                       - topLeft     (FP+2) : Colour for right and bottom
  542.  *                       - width       (FP+1) : Width
  543.  *                       - height      (FP+0) : Height
  544.  *
  545.  
  546. ULONG Box3d[] = {
  547.   IG_ADDI-1,                            * decrease height by one            *
  548.   IG_SWAP,                              * swap width and height             *
  549.   IG_ADDI-1,                            * decrease width by one             *
  550.   IG_SWAP,                              * swap again                        *
  551.   IG_GETFI+2,IG_Color,                  * get and set color for             *
  552.                     * left and top                      *
  553.   IG_GETFI+1,IG_Const+0,IG_Draw,        * draw a line of width to the right *
  554.   IG_GETFI+3,IG_Color,                  * get and set colour for            *
  555.                     * right and bottom                  *
  556.   IG_Const+0,IG_GETFI+0,IG_Draw,        * draw line of height to the bottom *
  557.   IG_GETFI+1,IG_NEG,IG_Const+0,IG_Draw, * draw line of negated              *
  558.                     * width to the right                *
  559.   IG_GETFI+2,IG_Color,                  * set colour for top and left       *
  560.   IG_Const+0,IG_GETFI+0,IG_NEG,IG_Draw, * draw line of height to the top    *
  561.   IG_RTF+4                              * clear stack and return            *
  562. };
  563.  
  564.  *
  565.  *
  566.  *    - Border3d    : Draw a double-bordered 3D rectangle using the procedure
  567.  *                    "Box3d".  As it is unknown if the rectangle is to appear
  568.  *                    highlighted or pressed, again two colours must be
  569.  *                    specified.  The subroutine "Box3d" is called twice, once
  570.  *                    with the parameters of Border3d and once with exchanged
  571.  *                    colours and a smaller inner rectangle.
  572.  *
  573.  *                    Parameters:
  574.  *
  575.  *                       - dark        (FP+3) : First colour
  576.  *                       - light       (FP+2) : Second colour
  577.  *                       - width       (FP+1) : Width
  578.  *                       - height      (FP+0) : Height
  579.  *
  580.  
  581. ULONG Border3d[] = {
  582.   IG_GETFI+2,IG_GETFI+3,     * push colours reversed onto the stack         *
  583.   IG_GETFI+1,IG_ADDI-2,      * get width decreased by two so that the inner *
  584.                  * rectangle is created                         *
  585.   IG_GETFI+0,IG_ADDI-2,      * get height decreaed by two                   *
  586.   IG_Const+1,IG_DUP,IG_Move, * move cursor by one pixel to bottom and left  *
  587.   &Box3d,IG_JSR,             * call "Box3d" with modified parameters        *
  588.   IG_Locate00,               * reset cursor to top left corner              *
  589.   &Box3d,IG_JSR,             * call "Box3d" for outer rectangle with the    *
  590.                  * original parameters                          *
  591.   IG_RTS                     * return; no parameter deallocation as already *
  592.                  * performed by "Box3d" (dirty trick)           *
  593. };
  594.  
  595.  *
  596.  *    - Rect3d      : Draw a filled 3D rectangle.  This routine uses "Box3d"
  597.  *                    to draw a border around the rectangle.  Now a third
  598.  *                    colour is needed, too, since the inner part of the
  599.  *                    rectangle is coloured, either.
  600.  *
  601.  *                    Parameters:
  602.  *
  603.  *                       - inner       (FP+4) : Colour of inner part
  604.  *                       - bottomRight (FP+3) : Colour for bottom and right
  605.  *                       - leftTop     (FP+2) : Colour for top and left
  606.  *                       - width       (FP+1) : Width
  607.  *                       - height      (FP+0) : Height
  608.  *
  609.  
  610. ULONG Rect3d[] = {
  611.   IG_GETFI+4,IG_Color,           * set inner colour                       *
  612.   IG_Const+1,IG_Const+1,IG_Move, * set inner cursor                       *
  613.   IG_GETFI+1,IG_ADDI-2,          * get width decreased by two for inner   *
  614.                  * rectangle                              *
  615.   IG_GETFI+0,IG_ADDI-2,          * get height decreased by two            *
  616.   IG_Box,                        * draw filled inner rect                 *
  617.   IG_Locate00,                   * back to the roots                      *
  618.   IG_DUPI+4,                     * get data for "Box3d". As the order is  *
  619.                  * the same, you could use the parameters *
  620.                  * already on the stack, but this is the  *
  621.                  * clean and neat solution.               *
  622.   &Box3d,IG_JSR,                 * call "Box3d"                           *
  623.   IG_RTF+5                       * return and clear stack                 *
  624. };
  625.  
  626.  *
  627.  *    - BigBorder3d : Draw a wide, filled 3D border.  The parameters are the
  628.  *                    same as for "Rect3d".
  629.  *
  630.  *                    Parameters:
  631.  *
  632.  *                       - inner       (FP+4) : Colour for inner border parts
  633.  *                       - bottomRight (FP+3) : Colour for bottom and right
  634.  *                       - leftTop     (FP+2) : Colour for top and left
  635.  *                       - width       (FP+1) : Width
  636.  *                       - height      (FP+0) : Height
  637.  *
  638.  
  639. ULONG BigBorder3d[] = {
  640.   IG_DUPI+4,&Box3d,IG_JSR,          * draw outer border *
  641.  
  642.   IG_GETFI+2,IG_GETFI+3,            * draw inner border *
  643.   IG_GETFI+1,IG_ADDI-30,
  644.   IG_GETFI+0,IG_ADDI-30,
  645.   IG_Const+15,IG_Const+15,IG_Move,
  646.   &Box3d,IG_JSR,
  647.  
  648.   IG_GETFI+4,IG_Color,              * set colour for inner part *
  649.  
  650.   IG_Const+1,IG_Const+1,IG_Locate,  * draw top bar *
  651.   IG_GETFI+1,IG_ADDI-16,
  652.   IG_Const+14,IG_Box,
  653.  
  654.   IG_Const+0,IG_Const-14,IG_Move,   * draw right bar *
  655.   IG_Const+14,
  656.   IG_GETFI+0,IG_ADDI-16,IG_Box,
  657.  
  658.   IG_Const+1,IG_Const+15,IG_Locate, * draw left bar *
  659.   IG_Const+14,
  660.   IG_GETFI+0,IG_ADDI-16,IG_Box,
  661.  
  662.   IG_Const+0,IG_Const-14,IG_Move,   * draw bottom bar *
  663.   IG_GETFI+1,IG_ADDI-16,
  664.   IG_Const+14,IG_Box,
  665.  
  666.   IG_Locate00,                      * clean up *
  667.   IG_RTF+5
  668. };
  669.  *
  670.  *   - Write3d      : Write text with shadow effect.  For that the text is
  671.  *                    first written in a darker shade and slightly shifted,
  672.  *                    then the text is again written in a lighter colour
  673.  *                    at the specified position.
  674.  *
  675.  *                    Parameters:
  676.  *
  677.  *                       - light       (FP+2) : Light colour
  678.  *                       - shade       (FP+1) : Shadow colour
  679.  *                       - text        (FP+0) : Text to be written (C string)
  680.  *
  681.  
  682. ULONG Write3d[] = {
  683.   IG_ModeA,                      * turn to "drawAPen"                 *
  684.   IG_GETFI+1,IG_Color,           * set darker colour                  *
  685.   IG_Const+1,IG_Const+1,IG_Move, * altered position for shadowed text *
  686.   IG_GETFI+0,IG_Text,            * write shadowed text                *
  687.   IG_Locate00,                   * back to the roots                  *
  688.   IG_GETFI+2,IG_Color,           * set light colour                   *
  689.   IG_GETFI+0,IG_Text,            * write text                         *
  690.   IG_RTF+3                       * clean up                           *
  691. };
  692.  
  693. */
  694.  
  695. #endif /* EGS_EGSINTUIGFX_H */
  696.  
  697.